package com.xx.happychatboot.serve.user.controller;


import com.xx.happychatboot.base.vo.response.ResponseDate;
import com.xx.happychatboot.serve.user.service.IUserFriendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Objects;

/**
 * <p>
 * 用户联系人表 前端控制器
 * </p>
 *
 * @author xiaoXuan
 * @since 2025-01-02
 */
@Controller
@RequestMapping("/userFriend")
public class UserFriendController {

    @Autowired
    private IUserFriendService userFriendService;

    /**
     * 获取好友信息
     * @param userId
     * @return
     */
    @GetMapping("/getContactList/{userId}")
    @ResponseBody
    private ResponseDate getContactList(@PathVariable("userId") Long userId) {
        if (Objects.isNull(userId)) {
            return ResponseDate.fail("出现异常，请联系管理员");
        }
        return ResponseDate.success(userFriendService.getContactList(userId));
    }
}

